import React, { Component } from 'react';
import FootNav from '../../component/FootNav'
import {connect} from 'react-redux';
import {Redirect} from "react-router-dom"
class Shop extends Component {
    constructor(props){
        super(props)
        this.state={
            isLogin:false
        }
    }
    componentWillMount(){
        this.setState({
            isLogin:this.props.isLogin
        })
    }
    render() {
        return (
            <div>
                {this.state.isLogin ? <div>我已经登录，现在是shop页面</div>:<Redirect to='/login'/>}
                <FootNav/>
            </div>
        );
    }
}

const mapStateToProps = state=>{
    return {
        isLogin:state.user.isLogin
    }
}

export default connect(mapStateToProps)(Shop);